" Simon Castillo <simoncastillo@gmail.com> 
" October 07, 2006 (Saturday, 11:59h)  
" I completely rip off everything from rezza and phrakture configs
set cmdheight=1
set encoding=utf-8
set termencoding=utf-8
set clipboard=unnamed
set nocompatible
set shortmess+=aI
set showcmd
set acd
if has('gui_running')
    set guioptions+=a
    set guioptions+=c
    set guioptions-=T
    set guioptions-=e
    colorscheme desert 
    if has('win32') 
        set columns=120
        set lines=60
        set guifont=Lucida\ Console
    else
        set guifont=Terminus\ 9
    endif
elseif (&term == 'screen.linux') || (&term =~ '^linux')
    set t_Co=8
    colorscheme desert
elseif (&term == 'rxvt-unicode') || (&term =~ '^xterm') || (&term =~ '^screen-256')
    set mouse=a
    set ttymouse=xterm
    colorscheme inkpot
else
    colorscheme desert
endif
filetype plugin indent on
set shell=/bin/sh
set splitbelow
set laststatus=2
set statusline=%-3.3n\ %f\ %r%#Error#%m%#Statusline#\ (%l/%L,\ %c)\ %P%=%h%w\ %y\ [%{&encoding}:%{&fileformat}]\ \ 
set vb
set t_vb=
set hlsearch
set ignorecase
set incsearch
set smartcase
set showmatch
set whichwrap=h,l,<,>,[,]
set backspace=indent,eol,start
set tabstop=4
set softtabstop=4
set shiftwidth=4
set textwidth=80
set expandtab
set nowrap
set history=500
set autoindent
set smartindent
set shiftround
set cinoptions=g0,:0,l1,(0,t0
set selection=inclusive
set number
set ruler
if has("folding")
    set foldenable
    set foldmethod=marker
    set foldlevel=100
endif
set complete=.,t,i,b,w,k
set wildchar=<tab>
set wildmenu
set wildmode=longest:full,full
if v:version >= 700
    set completeopt=menu,menuone,longest,preview
    set spelllang=en_us
    set spellsuggest=fast,20
    set numberwidth=1
endif
set formatoptions+=nl
set pastetoggle=<F10>
set previewheight=5
let html_use_css=1
" Change the <Leader> key here. By default it's ` but you can change for
" everything you want.
let mapleader="`" 
iab teh the
iab DATE <C-R>=strftime("%B %d, %Y (%A, %H:%Mh)")<CR>
iab maintainer Simon Castillo <simoncastillo@gmail.com>
" Clear autocmds - starts from a clean slate
autocmd!
" Fix file type detection
au BufNewFile,BufRead .torsmorc* set filetype=rc
au BufNewFile,BufRead *.inc set filetype=php
au BufNewFile,BufRead *.sys set filetype=php
au BufNewFile,BufRead grub.conf set filetype=grub
" C file specific options
au FileType c,cpp set cindent
au FileType c,cpp set formatoptions+=ro
au FileType c,cpp set makeprg=gcc\ -Wall\ -O2\ -o\ %<\ %
" HTML abbreviations
au FileType html,xhtml,php,eruby imap bbb <br />
au FileType html,xhtml,php,eruby imap aaa <a href=""><left><left>
au FileType html,xhtml,php,eruby imap iii <img src="" /><left><left><left><left>
au FileType html,xhtml,php,eruby imap ddd <div class=""><left><left>
" Compile and run key mappings
au FileType php map <F9> :!php &<CR>
au FileType python map <F9> :!python %<CR>
au FileType html,xhtml,php map <F9> :!firefox %<CR>
" MS Word document reading
au BufReadPre *.doc set ro
au BufReadPre *.doc set hlsearch!
au BufReadPost *.doc %!antiword "%"
au BufRead,BufNewFile PKGBUILD set ft=sh
" Help key bindings
nnoremap <F1> :help<Space>
map <F7> :!python -c 'help()'<left><left>
" Buffer handling
nnoremap <C-N> :bn!<CR>
nnoremap <C-P> :bp!<CR>
inoremap <C-x><C-f> <C-o>:e!<Space>
nnoremap <C-x><C-f> :e!<Space>
inoremap <C-x><C-s> <C-o>:w!<CR>
nnoremap <C-x><C-s> :w!<CR>
inoremap <C-x><C-n> <C-o>:bn!<CR>
inoremap <C-x><C-p> <C-o>:bp!<CR>
" ~/.vimrc goodies 
nnoremap <Leader><F2> :e! ~/.vimrc<CR>
nnoremap <Leader><F5> :w!<CR>:source ~/.vimrc<CR>
" Because I am too lazy
map q :confirm qa<CR>
" Frames or whatever they are called.
" There are probably better ways to set a key binding for both, insert and normal modes,
" I am just stupid (and apparently a thief too).
inoremap <M-/> <C-x><C-o>
inoremap <C-x>2 <C-o><C-w>s
nnoremap <C-x>2 <C-w>s
inoremap <C-x>3 <C-o><C-w>v
nnoremap <C-x>3 <C-w>v
inoremap <C-x>0 <C-o><C-w>c
nnoremap <C-x>0 <C-w>c
inoremap <C-x>1 <C-o><C-w>o
nnoremap <C-x>1 <C-w>o
inoremap <C-x>o <C-o><C-w>w
nnoremap <C-x>o <C-w>w 
inoremap <C-x><C-o> <C-o><C-w>w
nnoremap <C-x><C-o> <C-w>w
inoremap <M-x> <C-o>:
nnoremap <M-x> :
vnoremap <M-w> "ly
vnoremap <Backspace> x
inoremap <C-x>u <C-o>u
nnoremap <C-x>u u
inoremap <C-x>w <C-o>x
nnoremap <C-x>w <C-o>x
vnoremap <C-x>w x
nnoremap <C-x>s :w!
inoremap <A-o> <C-o>o
nnoremap <A-o> <C-o>o
noremap <silent> <F3> :tabn <cr>
noremap <silent> <F4> :tabp <cr>
noremap <silent> <C-t> :tabnew<cr>
" insert mode
inoremap <C-h> <Left>
inoremap <C-j> <Down>
inoremap <C-k> <Up>
inoremap <C-l> <Right>
" I write with my right hand but technically, years of counter strike made my
" left hand better with keyboards =D
" Set up the status line
nnoremap <C-e> ggVG
syntax on
